<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //2. 修改某些Object方法返回结果
        //好处就是在处理异常代码时不用再try..catch了，因为它返回的是布尔值，所以程序也不会因为异常中断了
        let obj = {}
        Reflect.defineProperty(obj, "name", {
            value: "twj",
            writable: false, //设置属性值不可改
            enumerable: false //设置name属性不可删
        })
        let res = Reflect.defineProperty(obj, "name", {
            value: "whh" //再次修改了属性值，就会返回false
        })
        console.log(res) //false
    </script>
</body>

</html>